#!/bin/bash

SCRIPT_DIR=$(cd $(dirname $0); pwd)

PROGRAM_NAME="dev-assistant-backend"

cd $SCRIPT_DIR

PROGRAM_PATH=$SCRIPT_DIR/$PROGRAM_NAME

if [ ! -f $PROGRAM_PATH ]; then
    echo "$PROGRAM_NAME not found"
    exit 1
fi

if [ ! -d $SCRIPT_DIR/logs ]; then
    mkdir -p $SCRIPT_DIR/logs
fi

chmod +x $PROGRAM_PATH

nohup $PROGRAM_PATH > $SCRIPT_DIR/logs/sys.log 2>&1 &

echo "start $PROGRAM_NAME success"

exit 0;

